package thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) throws IOException {

//        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入一个数字：");
        BufferedReader br=new BufferedReader(//字符流
                new InputStreamReader(//转换流
                        System.in//字节流
                )
        );
       String line= br.readLine();
        int num=Integer.parseInt(line);
        for (;num>0;num--){
            System.out.println(num);
            try {
                Thread.sleep(1000);//主线程执行会阻塞5秒
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("时间到");

    }
}
